<?php
class TagTree extends Zend_Db_Table
{
	protected $_name ="tag_tree";
	protected $_primary = 'id';

 //根据id 查询tag_tree
    public function gettagtreeByid($id){
          $select = $this->select();
          $select->where("id=".$id);
          return $this->fetchAll($select)->toArray();
    }

 //根据tree_id 查询tag_tree
    public function gettagtreeBytree_id($tree_id){
          $select = $this->select();
          $select->where("tree_id=".$tree_id);
          return $this->fetchAll($select)->toArray();
    }

 //更新tag_tree
    public function updatetagtreeByid($array,$id){

		$db = $this->getAdapter();
		$where=$db->quoteInto('id = ?', $id);
		$this->update($array, $where);
	}
//删除tag_tree
     public function deltagtreeByid($id,$tag_id){
         $where = 'id = '. $id;
         $this->delete($where);
         
         $where = 'pid = '. $tag_id;
         $this->delete($where);
         return true;
    }

}

